package com.huatai.xxljob.controller;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author gusiyi
 * @version 1.0
 * @className TestJob
 * @description 描述：
 * @date 2024/7/2 21:34
 */
@Component
@Slf4j
public class TestJob {

	@XxlJob("TestSwitch")
	public String testSwitch() throws InterruptedException {
		String jobParam = XxlJobHelper.getJobParam();
		switch (jobParam){
			case "1":
				Thread.sleep(1000);
				log.info("1");
				break;
			case "2":
				Thread.sleep(2000);
				log.info("2");
				break;
			case "3":
				Thread.sleep(3000);
				log.info("3");
				break;
			case "4":
				Thread.sleep(4000);
				log.info("4");
				break;
			default:
				break;
		}
		return jobParam;
	}
}
